package com.example.video.common.util;

/**
 * <p>
 * 请求响应封装工具类
 * <p/>
 *
 * @author : yj
 */
public class ResponseWrapUtil {

    public static <T>ResponseWrap<T> success(){
        return new ResponseWrap<T>().setCode(ResponsEnum.SUCCESS.code).setMsg(ResponsEnum.SUCCESS.msg);
    }

    public static <T>ResponseWrap<T> success(T data){
        return new ResponseWrap<T>().setData(data).setCode(ResponsEnum.SUCCESS.code).setMsg(ResponsEnum.SUCCESS.msg);
    }

    public static <T>ResponseWrap<T> success(String msg){
        return new ResponseWrap<T>().setCode(ResponsEnum.SUCCESS.code).setMsg(msg);
    }

    public static <T>ResponseWrap<T> success(T data, String msg){
        return new ResponseWrap<T>().setData(data).setCode(ResponsEnum.SUCCESS.code).setMsg(msg);
    }

    public static <T>ResponseWrap<T> error(String msg){
        return new ResponseWrap<T>().setCode(ResponsEnum.ERROR.code).setMsg(msg);
    }

    public static <T>ResponseWrap<T> error(String msg,T data){
        return new ResponseWrap<T>().setCode(ResponsEnum.ERROR.code).setMsg(msg).setData(data);
    }

    public static <T>ResponseWrap<T> error(Integer code, String msg){
        return new ResponseWrap<T>().setCode(code).setMsg(msg);
    }
}
